package demo.SmartHomePlatformDamo;
// 智能控制系统
public class SmartHomeControl {
    // 单例类
    private static final SmartHomeControl smartHomeControl=new SmartHomeControl();
    private SmartHomeControl() {}
    public static SmartHomeControl getInstance() {
        return smartHomeControl;
    }


    public void control( HomeAppliances homeAppliances){
        System.out.println(homeAppliances.getName()+"目前状态： "+(homeAppliances.isStatus()?"开启":"关闭"));
        System.out.println("请开始操作。。。");
        homeAppliances.press();
        System.out.println(homeAppliances.getName()+"目前状态已改为： "+(homeAppliances.isStatus()?"开启":"关闭"));
    }

    public void printAllStatus( HomeAppliances[] homeAppliances ) {
        for (int i = 0; i < homeAppliances.length; i++) {
            System.out.println(homeAppliances[i].getName()+"目前状态： "+(homeAppliances[i].isStatus()?"开启":"关闭"));
        }
    }
}
